package com.netitv.web.manager;

import java.text.SimpleDateFormat;
import java.util.*;
import com.netitv.domain.*;

import org.apache.log4j.Logger;
import org.jfree.chart.renderer.category.BarRenderer3D;
import org.jfree.ui.TextAnchor;


import com.netitv.domain.channel_orderDetail;
import com.netitv.service.DayClickService;
import com.netitv.service.analysisService;
import com.netitv.util.BaseAction;
import com.netitv.util.BeanFactory;
import com.netitv.util.HttpUtil;
import com.opensymphony.xwork2.ActionContext;

public class analysisAction extends BaseAction{
	
	private static final long serialVersionUID = -2058552092655034339L;
	
	private static Logger logger = Logger.getLogger(FilmAction.class);
	private List<channel_orderDetail> chlist;
	private String selectTime;	
	private dayClick dayClick;
	 @Override    
	 public String execute() throws Exception    {        
		 return SUCCESS;    
		 } 
	 /**
	  * 产品包统计
	  * @return
	  */
	public String channelAnalysis(){
		analysisService channelService = (analysisService)BeanFactory.getBeanByName("analysisService");
		if(selectTime==null||selectTime==""){
			SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd");
			selectTime=sdf.format(new Date());
			System.out.println(selectTime);
		}else{
			String str="";
			for(int i=0;i<selectTime.length();i++){
				if(!"-".equals(selectTime.substring(i, i+1))){
					str+=selectTime.substring(i, i+1);
				}
			}
			selectTime=str;
			System.out.println(selectTime);
		}
		chlist=channelService.ChannelAnalysis(selectTime);
		return "channelAnalysis";
	} 
	
	/**
	 * 日点击
	 * @return
	 */
	public String addDayClick(){
		DayClickService dayClickService = (DayClickService)BeanFactory.getBeanByName("dayClickService");
		System.out.print(HttpUtil.getUserId(request));
		dayClickService.addDayClick(dayClick);
		return "addDayClick";
	}
	public static void main(String args[]){
		new analysisAction().channelAnalysis();
	}
	public List<channel_orderDetail> getChlist() {
		return chlist;
	}
	public void setChlist(List<channel_orderDetail> chlist) {
		this.chlist = chlist;
	}
	public String getSelectTime() {
		return selectTime;
	}
	public void setSelectTime(String selectTime) {
		this.selectTime = selectTime;
	}
	public dayClick getDayClick() {
		return dayClick;
	}
	public void setDayClick(dayClick dayClick) {
		this.dayClick = dayClick;
	}
	
	
}
